package com.example.report.serviceImpl;

import com.example.report.dao.ReportDAO;
import com.example.report.entity.ReportExcel;
import com.example.report.service.ReportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/*pagehelper 分页逻辑必须在service层*/

@Service("ReportServiceImpl")
public class ReportServiceImpl implements ReportService {

    @Autowired
    ReportDAO reportDAO;

    @Override
    public PageInfo<ReportExcel> queryData(ReportExcel reportExcel,
           int pageNum, int pageSize) {

        PageHelper.startPage(pageNum,pageSize);
        List<ReportExcel> list = reportDAO.queryData(reportExcel);
        PageInfo<ReportExcel> dataList  =  new PageInfo<ReportExcel>(list);

        return dataList;
    }
}
